<%@ page language="java" import="java.util.*" import="com.AO.DAO.*" import="org.hibernate.*" pageEncoding="utf8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
   String id=(String)request.getAttribute("Foodid");
   request.removeAttribute("Foodid");
   FoodDAO dao=new FoodDAO();
   Food food=dao.findById(id);
%>
<!DOCTYPE html>
<!-- saved from url=(0039)foodfood/recipe/89570/ -->
<html  class=""><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  


    <title>food</title>
    <link  href="./files/favicon.ico"  rel="shortcut icon"  type="image/x-icon">
  	
	
	<link  href="./files/base.d706c3c6.compress.css"  rel="stylesheet"  type="text/css">
	
	
	
	<link  href="./files/other.0b3c792c.compress.css"  rel="stylesheet"  type="text/css">
	
	
	
	<link  href="./files/recipe.0c2d5c62.compress.css"  rel="stylesheet"  type="text/css">
	
	
	<body  style="">
	
	
	
		<div  class="popup-layer">
		
		
		  
			<div  class="reveal-modal-bg"></div>
		  
		
		  
			<div  class="reveal-modal large normal-font"  id="feedbackModal">
			  
			  <div  class="reveal-modal-title-bar">
			    <div  class="reveal-modal-title">意见反馈</div>
			    <a  href="javascript:void(0)"  class="close-reveal-modal"  rel="nofollow"></a>
			  </div>
			  <div  class="reveal-modal-main">
			    
			    
			    <form  action="foodfood/feedback/create/"  method="POST">
			      <textarea  name="feedback"  rows="3"></textarea>
			      <input  type="hidden"  name="xf"  value="None">
			      <input  type="submit"  value="提交"  class="button">
			    </form>
			  </div>
			</div>
		</div>
		
		<div  class="topbar-outer">
		  <div  class="topbar-container">
		    <div  class="topbar">
		      
		
		
		
		  <div  class="pure-g">
		    <div  class="pure-u-1-6">
		      <a  href="/foodfood/AOHomePage..action" class="logo"><img src="./files/logo.png"></a>
		    </div>
		    <div  class="pure-u-5-6">
		      <div  class="pure-g">
		        <div  class="pure-u-11-24">
		        <form class="search" action="/foodfood/Search.action">
                                 <input type="text" name="keyword" class="typeahead float-left" data-default-text="" value="" placeholder="菜谱、食材">
                                 <input type="hidden" name="type" value="fmf">
                                 <input type="submit" value="搜索" class="button float-left">
                                </form>
		        </div>
		        <div  class="pure-u-1-3">
		          <ul  class="site-nav plain pure-g">
		            <li  class="pure-u"><a  href="/foodfood/AOHomePage..action"  data-ga-event="公共页面/导航栏/$text">首页</a></li>
		            <li  class="topbar-cats pure-u">
		            <a  href="/foodfood/AOMenu..action"  class="block-link"  data-ga-event="公共页面/导航栏/$text"><span>菜谱分类</span></a>
		            <%MaterialFoodTypesDAO daoindex=new MaterialFoodTypesDAO();
											FoodTypesDAO daofindex=new FoodTypesDAO();
											List<MaterialFoodTypes>listindex=daoindex.findByMaterialFoodTypeLevel(1);
											List<FoodTypes>listfindex=daofindex.findByFoodTypeLevel(1); 
											MaterialFoodOfSeasonDAO dao5index=new MaterialFoodOfSeasonDAO();
											List<MaterialFoodOfSeason>list5index=dao5index.findAll();%>
												<div class="topbar-cats-submenu hidden">
													<div class="topbar-cats-submenu-bg">
		
														<ul class="plain">
															<li class="topbar-cat-head">常用主题</li>
															<% int k=0;for(FoodTypes ft:listfindex)
										                    {if(k++==8)break;%>
															<li><a
																href="/foodfood/AOFoodMenu.<%=ft.getFoodTypeId() %>.action"
																title="<%=ft.getFoodTypeName() %>菜谱大全" data-ga-event="公共页面/导航栏/$text"><%=ft.getFoodTypeName() %></a>
															</li>
															<%} %>
														</ul>
														<ul class="plain">
														   <li class="topbar-cat-head">常见食材</li>
														   <% k=0;for(MaterialFoodTypes ft:listindex)
										                    {if(k++==8)break;%>													
															<li><a href="/foodfood/AOMfoodMenu.<%=ft.getMaterialFoodTypeId() %>.action"
																title="<%=ft.getMaterialFoodTypeName() %>做法大全" data-ga-event="公共页面/导航栏/$text"><%=ft.getMaterialFoodTypeName() %></a>
															</li>
														   <%} %>
														</ul>
														<ul class="plain">
															<li class="topbar-cat-head">时令食材</li>
															<%k=0;for(MaterialFoodOfSeason mfos:list5index)						    
											               {if(k++==8)break;%>
															<li><a href="/foodfood/AOMfood.<%=mfos.getMaterialFood().getMaterialFoodId() %>.action"
																title="<%=mfos.getMaterialFood().getMaterialFoodName() %>做法大全" data-ga-event="公共页面/导航栏/$text"><%=mfos.getMaterialFood().getMaterialFoodName() %></a>
														   <%} %>
														</ul>
														<div class="topbar-cats-submenu-bottom">
															<a href="/foodfood/AOMenu..action"
																data-ga-event="公共页面/导航栏/$text">查看全部分类</a>
														</div>
		
													</div>
												</div>
		            </li>
		            <li  class="pure-u"><a  href="/foodfood/AOFoodInMenuList..action"  data-ga-event="公共页面/导航栏/$text">菜单</a></li>
		          </ul>
		        </div>
		        <div  class="pure-u-5-24 clearfix">
		
		          <div  class="user-action">
		           	 <div class="user-action">
			              <%
								String account = (String)session.getAttribute("account");
								if(account==null)
								{
								    account="";
								}
								String nickname = (String)session.getAttribute("nickname");
    	
				              	if(nickname!=null)
				           		{
							%>
							<a href="/foodfood/AOCooker.<%=account%>.action"><%=nickname%></a>
							<a onclick="logout()" href="index.jsp">退出</a>
							<%
								}
				               	else
				               	{
							%>
							<a href="register.jsp" data-ga-event="公共页面/导航栏/$text">注册</a> <a
								href="login.jsp" data-ga-event="公共页面/导航栏/$text">登录</a>&nbsp;&nbsp;
							<%
								}
							%>
			
			          </div>
		          </div>
		        </div>
		      </div>
		    </div>
		  </div>
		
		
		    </div>
		  </div>
		</div>
		
		
		<div  class="page-outer">
		  
		  <div  class="page-container">
		    
		      <div  class="pure-g">
		        
		        <div  class="pure-u-2-3 main-panel">
		          
		
		  
		  <div  itemscope=""  itemtype="http://schema.org/Recipe">
		    <meta  class="hidden"  itemprop="interactionCount"  content="UserComments:1">
		    <meta  class="hidden"  itemprop="interactionCount"  content="UserLikes:94">
		    <meta  class="hidden"  itemprop="dateCreated"  content="2011-07-30">
		    <h1  class="page-title"  itemprop="name">
		       <%=food.getFoodName() %>
		    </h1>
		    <div  class="block block-has-padding white-bg recipe-show">
		      <div  class=" image expandable block-negative-margin"  style="background:url(<%=food.getImg() %>) no-repeat center;background-size:100% 100%;">
		        <img  src="<%=food.getImg() %>"  alt="<%=food.getFoodName() %>的做法"  width="620"  itemprop="image">
		      </div>
		
		
		      <div  class="container pos-r">
		        <div  class="stats">
		<div class="score" itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/aggregateRating">
            <div class="overview">
            <% String str=food.getEvaluation();
               String[] list=str.split(",");
               double good=Double.parseDouble(list[0]);
               double simple=Double.parseDouble(list[1]);
               double bad=Double.parseDouble(list[2]);
               double total=good+simple+bad;
               double percentsG=1;
               double percentsS=1;
               double percentsB=1;
               double grade=0;
               if(total!=0)
               {
                    percentsG=good/total;
                    percentsS=simple/total;
                    percentsB=bad/total;
                    grade=(40+60*percentsG+40*percentsS+30*percentsB);
                    grade=(double)((int)(grade*10))/10;
               }
               
               
             %>
              <span class="number" itemprop="ratingValue"><%=grade %></span>
              <div class="title">综合评分</div>
            </div>
            <div class="detail">
              <div class="title">大家对这个菜谱的评价（<strong itemprop="ratingCount"><%=(int)total %></strong> 份）</div>
              <table>
                <tbody><tr>
                  <td class="kind">好极了</td>
                  <td class="bar"><div class="rate3" style="width:<%=percentsG*100%>%"></div></td>
                  <td class="num"><%=(int)good %></td>
                </tr>
                <tr>
                  <td class="kind">挺好</td>
                  <td class="bar"><div class="rate2" style="width:<%=percentsS*100%>%"></div></td>
                  <td class="num"><%=(int)simple %></td>
                </tr>
                <tr>
                  <td class="kind">一般</td>
                  <td class="bar"><div class="rate1" style="width:<%=percentsB*100%>%"></div></td>
                  <td class="num"><%=(int)bad %></td>
                </tr>
              </tbody></table>
            </div>
          </div>
		          <div  class="cooked">
		            <div  class="overview">
		              <span  class="number">10</span>
		              <div  class="title">人做过这道菜</div>
		              <div  class="link">
		                      <a  href="/foodfood/create.jsp"  rel="nofollow"  class="red-link">上传你做的<%=food.getFoodName() %></a>
		              </div>
		            </div>
		          </div>
		        </div>
		        <div  class="collect pure-g align-right">
		            <a  class="icon collect-icon"  title="添加到菜单"  href="foodfood/auth/login/?path=/recipe/89570/"  rel="nofollow"></a>
		            <a  href="foodfood/auth/login/?path=/recipe/89570/"  class="button large-button collect-button"  rel="nofollow">收藏</a>
		        </div>
		
		        <div  class="sharing">
		              
		

		
		
		        </div>
		      </div>
		
		      
		      <div  class="rate-dialog block-negative-margin">
		      </div>
		
		      
		
		      
		
		      <h2>简介</h2>
		      <div  class="desc"  itemprop="description">
		        <%=food.getDescription() %>
		      </div>
		
		      <div  class="author">
		          <a  href="/foodfood/AOCooker.<%=food.getUser().getAccount() %>.action"  title="<%=food.getUser().getNickName() %>"  class="avatar-link">
		            <img  src="<%=food.getUser().getImg()%>"  alt="<%=food.getUser().getNickName() %>"  width="30"  height="30">
		            &nbsp;<span  itemprop="author"><%=food.getUser().getNickName() %></span>
		          </a>
		      </div>
		
		      
		        
		        <h2>
		          用料 &nbsp;
		        </h2>
		         <div  class="ings">
		          <table>
		            <tbody>
		        <%
		           Set<FoodMaterialFoodRelation> set=food.getFoodMaterialFoodRelations();
		           for(FoodMaterialFoodRelation fmfr:set)
		           {
		         %>                         
		              <tr  itemprop="ingredients">
		                <td  class="name has-border">
		                  
		
		    <a  href="/foodfood/AOMfood.<%=fmfr.getMaterialFood().getMaterialFoodId()%>.action"><%=fmfr.getMaterialFood().getMaterialFoodName() %></a>
		
		                </td>
		                <td  class="unit has-border">
		                <%=fmfr.getCount()%>
		                </td>
		              </tr>
		         <%}%>
		          </tbody></table>
		        </div>
		
		      
		
		        
		        <h2  id="steps">
		         <%=food.getFoodName() %>的做法 &nbsp;
		        </h2>
		          
		        <div  class="steps">
		          <ol  itemprop="recipeInstructions">
		          <%Query q=dao.getSession().createSQLQuery("select description,img from food_practice_steps where belong_to='"+food.getFoodId()+"' order by step");  
		             List<Object[]> li=(List<Object[]>)q.list();
		          int i=0;for(Object[] fps:li){i++;%>  
		            <li  class="container">
		              <p  class="text"  style="width: 100%;"><%=fps[0]%></p>
		              <img src="<%=fps[1] %>" alt=" <%=food.getFoodName() %>的做法 步骤<%=i %>" width="200">
		            </li>
		         <% }%>
		          </ol>
		        </div>
		
		
		
		      <div  class="tip-container">
		        <h2>小贴士</h2>
		        <div  class="tip">
		         <%=food.getPs()%>
		        </div>
		      </div>
	
		
		      <h2><%=food.getFoodName() %>的答疑</h2>
		      <div  class="questions"  id="recipe-qa">
		        
		        <ul  class="question-list plain">
		        </ul>
		          <div  class="add-question">
		            <p>关于<%=food.getFoodName() %>的做法还有疑问？<a  href="/foodfood/auth/login/"  data-url="/recipe/89570/add_question/"  rel="nofollow">提一个问题</a></p>
		          </div>
		      </div>
		    </div>
		  </div>
		 	  
		
		          <div  id="main-panel-bottom"></div>
		        </div>
		        
		
		        
		        <div  class="pure-u-1-3 right-panel">
		          
		  
		  
		  <div  class="page-title">&nbsp;</div>
		
		
		
		
		<%!
		
		void showTypes(List<String> list,JspWriter out,FoodTypesDAO dao)throws Exception
		{
		      List<String>nextList=new ArrayList();
		      for(String f:list)
		      {
		      FoodTypes ft=dao.findById(f);
		      if(ft!=null)
		      {
		      try{
		         out.print("<a  href=\"/foodfood/AOFoodMenu."+ft.getFoodTypeId()+".action\"  title=\""+ft.getFoodTypeName()+"\">"+ft.getFoodTypeName()+" </a>");
		         
		         }
		         catch(Exception e)
		         {
		         
		         }
		       nextList.add(ft.getFoodTypeId().substring(0,ft.getFoodTypeId().length()-3));
		       }
		      }
		      if(nextList.size()!=0)
		      showTypes(nextList,out,dao);
		
		}
		  
		 %>
		  
		  
		  
		  <div  class="recipe-tags block block-has-padding white-bg">
		    <div  class="title-bar">
		      <h3  class="title">所在分类</h3>
		    </div>
		    <div  class="content">
		      <div  class="recipe-cats">
		      <%Set<FoodFoodTypesRelation> set2=food.getFoodFoodTypesRelations();
		        List<String> list3=new ArrayList<String>();
		        for(FoodFoodTypesRelation fftr:set2)
		        {
		               list3.add(fftr.getFoodTypes().getFoodTypeId());
		        }
		        FoodTypesDAO dao5=new FoodTypesDAO();
		        showTypes(list3,out,dao5);
		      %>
		      
		        
		      </div>
		    </div>
		  </div>
		  
		
		
		  
		  <div  class="recipe-menus block block-has-padding white-bg">
		  
		    <div  class="title-bar">
		      <h3  class="title">被加入到菜单</h3>
		      <div  class="right-action">
		      </div>
		    </div>
		    <div  class="content">
		      <ul  class="plain list">
		      <%Set<FoodFoodMenuRelation> set4=food.getFoodFoodMenuRelations();
		      for(FoodFoodMenuRelation ffmr:set4)
		      {%>
		            <li><a  href="/foodfood/AOFoodInMenu.<%=ffmr.getFoodMenu().getMenuId() %>.action"  title="<%=ffmr.getFoodMenu().getMenuName()%>"><span  class="ellipsis"><%=ffmr.getFoodMenu().getMenuName()%></span></a></li>
		            <%} %>
		      </ul>
		      <div  class="all-menus">
		        <a  href="/foodfood/AOFoodInMenuList..action"  title="<%=food.getFoodName() %>的全部菜单">全部菜单</a>
		      </div>
		    </div>
		  </div>
		  
		

		  <div  class="recipe-comments block">
		    <a  href="foodfood/recipe/89570/comments/"  title="<%=food.getFoodName() %>的留言"><%=food.getFoodName() %>的留言 </a>
		  </div>
		  
		
		  
		  <div  class="recipe-stats block small-font gray-font">
		    <div  class="time">该菜谱创建于 <%=food.getCreateDatetime().toString().substring(0,10) %></div>
		    <div  class="pv">94 收藏</div>
		    <div  class="copyright">
		        版权归作者所有，没有作者本人的书面许可任何人不得转载或使用整体或任何部分的内容。<br>
		      <br>
		    </div>
		  </div>
		  
		
		
		  
		   <div  class="right-ad block">
		     
		
		
		
		<script  type="text/javascript">BAIDU_CLB_fillSlot("961615");</script>
		
		   </div>
		
		
		  
		
		        </div>
		        
		      </div>
		    
		  </div>
		  
		</div>
		
	
		
		
		  
		  <script  type="text/javascript"  src="./files/jquery.min.js"></script>
	
		<script  type="text/javascript"  src="./files/2013.anonymous.0a0601dc.compress.js"></script><img  id="scrollTop"   style="opacity: 1; position: fixed; width: 50px; height: auto; z-index: 20; border: 0px; padding: 0px; bottom: 20px; right: 20px; margin: 0px; cursor: pointer; display: block;">
		
		
		<div  id="color_timer"></div>
		
		
		
		
	
	</body>
</html>